package controllers;

import java.util.List;

import models.my.MyMessage;
import models.user.PortraitUserInfo;
import play.mvc.Controller;
import play.mvc.Result;
import utils.MengException;
import views.html.mymsg;

public class UserMessage extends Controller{
	
	public static Result message(int page, int size) {
		String username = session().get("username");
		try {
			List<MyMessage> message = MyMessage.getInstances().getMessagePage(username, page, size);
			PortraitUserInfo ptui = PortraitUserInfo.getInstances().getPUI(username); 
			return ok(mymsg.render(message,ptui));
		} catch (MengException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return ok("get Message failure");
	}

}
